<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<!DOCTYPE html>
	<html lang="en" class="no-ie" style="overflow:hidden;">
		<head>
			<meta charset="UTF-8">
			<title>间隔柱状</title>
			<script>
				"object" != typeof ue || "object" != typeof ue.interface ? ("object" != typeof ue && (ue = {}), ue.interface = {},
					ue.interface.broadcast = function(e, t) {
						if ("string" == typeof e) {
							var o = [e, ""];
							void 0 !== t && (o[1] = t);
							var n = encodeURIComponent(JSON.stringify(o));
							"object" == typeof history && "function" == typeof history.pushState ? (history.pushState({}, "",
								"#" + n), history.pushState({}, "", "#" + encodeURIComponent("[]"))) : (document.location
								.hash = n, document.location.hash = encodeURIComponent("[]"))
						}
					}) : function(e) {
					ue.interface = {}, ue.interface.broadcast = function(t, o) {
						"string" == typeof t && (void 0 !== o ? e.broadcast(t, JSON.stringify(o)) : e.broadcast(t, ""))
					}
				}(ue.interface), (ue4 = ue.interface.broadcast);
			</script>
			<script src="./dist/echarts.min.js"></script>
			<script src="./static/js/jquery.min.js"></script>
			<script>
				$(function() {
					ue4("getSize", {
						mes: "get windows size"
					});
					ue4("getColor", {
						mes: "get all color"
					});
					ue4("getData", {
						mes: "get all data"
					});
					ue4("beginSize", {
						mes: BeginSize[0],
						mes2: BeginSize[1]
					});
					ue4("beginSizeY", {
						mes: BeginSize
					});
				});
				/*$(function () {
				    
				});*/
			</script>
			<style>
				* {
					margin: 0;
					padding: 0;
					
				}
			</style>
		</head>
		<body>
			<div id="main"></div>
			<!--
		dataTemp1: y轴数值;dataTemp2: x轴标题
		
		-->
			<script>
				let BeginSize = [312, 260];
				let myChart = null;
				let datacat = ['鄞州区', '海曙区', '江北区', '镇海区', '北仑区', '奉化区']
				let databar = [1680, 2500, 2860, 1899, 2500, 1886];

				function fresh() {

					let option = {
						backgroundColor: 'rgba(13,29,70,0.75)',
						grid: {
							top: '10%',
							bottom: '0%',
							left: '13%',
							height: '60%',
							width: '80%',
							height: '80%'
						},
						title: {
						    text: "(公斤)",
						    left: "3%",
						    bottom: "2%",
						    textStyle: {
						      fontSize: 9,
							  color: 'rgba(255, 255, 255, 0.77)',
							  fontWeight:400,
						    },
						  },
						xAxis: [{
							type: 'category',
							axisLabel: {
								show: true,
								color: '#FFFFFF',
								fontSize: 11,
								fontWeight:500,
								interval:0
							},
							splitLine: {
								show: true,
								lineStyle: {
									type: 'solid',
									color: 'rgba(255, 255, 255, 0.1)',
									width: 1
								}
							},
							axisLine: {
								show: true,
								lineStyle: {
									type: 'solid',
									color: 'rgba(255, 255, 255, 0.4)',
									width: 1
								}
							},
							axisTick: {
								show: false,
							},
							data: datacat
						}],
						yAxis: [{
								type: 'value',
								splitLine: {
									show: true,
									lineStyle: {
										type: 'solid',
										color: 'rgba(255, 255, 255, 0.1)',
										width: 1
									}
								},
								axisLine: { //y轴
									show: true,
									lineStyle: {
										type: 'solid',
										color: 'rgba(255, 255, 255, 0.4)',
										width: 1
									}
								},
								axisTick: {
									show: false
								},
								axisLabel: {
									color: 'rgba(255, 255, 255, 0.77)',
									fontSize: 9,
									fontWeight:400
								},
							}
						],
						series: [{
								name: '进货总量',
								type: 'bar',
								barWidth: 18,
								data: databar,
								itemStyle: {
									color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
											offset: 0,
											color: 'rgba(1, 81, 225, 1)'
										},
										{
											offset: 1,
											color: 'rgba(1, 23, 83, 0)'
										}
									])
								}
							}
						]

					};
					myChart = echarts.init(document.getElementById('main'));
					myChart.setOption(option);
				}

				fresh();


				//浏览器测试用
				change(BeginSize[0], BeginSize[1]);

				function change(x, y) {
					let div = document.getElementById("main");
					//alert("I am an alert box!!");
					div.style.width = x + "px";
					div.style.height = y + "px";
					var myOption = myChart.getOption();
					myChart.resize();
					let types = []
					myOption.series.forEach((item) => {
						types.push(item.type)
					})
					return types
				}
				/************下面数据***********/
				ue.interface.TransData1 = function(data) {
					dataTemp1 = data;
					fresh();
				};
			</script>
		</body>
	</html>

	<body>
	</body>
</html>
